import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_app/openeye/utils/toast_utils.dart';

///author: create by SunJH
///时间: 2022/1/19 0019
///邮箱: 965989158@qq.com
///描述: flutter 图文混排效果测试

class TextRichTest extends StatelessWidget {
  const TextRichTest({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return  Scaffold(
      body: Center(
        child: TextButton(
          style: ButtonStyle(backgroundColor: MaterialStateProperty.resolveWith((states){
            return null;
          }),
          overlayColor: MaterialStateProperty.all(Colors.transparent),
          ),
          child: const Icon(
            Icons.arrow_back,
            size: 24,
            color: Color(0x6819435b),
          ),
          onPressed: () async {
            ToastUtils.showTip("点击了回退按钮");
          },
        ),
      ),
    );
  }

 Widget textRichPage() {
    return  const Center(
      child: Text.rich(TextSpan(
          children: [
            TextSpan(text: "flutter 图文混排效果测试flutter 图文混排效果测试flutter 图文混排效果测试flutter 图文混排效果测试flutter 图文混排效果测试flutter 图文混排效果测试flutter 图文混排效果测试flutter 图文混排效果测试flutter 图文混排效果测试flutter 图文混排效果测试flutter 图文混排效果测试flutter 图文混排效果测试flutter 图文混排效果测试"),
            WidgetSpan(child: Icon(Icons.call)),
          ]
      ),
        maxLines: 2,
        overflow: TextOverflow.ellipsis,
      ),
    );
  }
}
